package com.softer.ztb.controller;

import com.softer.ztb.entity.SysMenu;
import com.softer.ztb.service.HomeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.List;
/**
 * HomeController class
 * @author zcz
 * @date 2019/1/16
 */
@RestController
@RequestMapping("/home")
@Slf4j
public class HomeController {
    @Autowired
    HomeService homeService;
    @RequestMapping("/getMenu")
    @ResponseBody
    public List<SysMenu> getMenu(HttpSession session) {
        String userName = (String) session.getAttribute("userName");
        return homeService.getMenu(userName);
    }
}
